<?php

require ("db_emp_conn.php");
$bbsid = isset($_GET['id']) ? $_GET['id'] : 0;
if (empty($_POST)) {
    $rs = $conn->query("SELECT * FROM `yuangongbiao`.`yuangongbiao` where id='{$bbsid}'");
    print_r($rs->num_rows);
    $row = $rs->fetch_assoc();
    require("edit_html.php");
} else {
    $name = $_POST["name"];
    $department = $_POST["department"];
    $photo = $_POST["imgurl"];
    $birthday = $_POST["birthday"];
    $entry = $_POST['entry'];
    $sql = "update `yuangongbiao`.`yuangongbiao` set name='$name',department='$department',photo='$photo',birthday='$birthday',entry='$entry' where `yuangongbiao`.`yuangongbiao`.id='{$bbsid}'";
    $rs = $conn->query($sql);
    if ($rs) {
        echo"<script language='javascript' type='text/javascript'>";
        echo"alert('修改成功');";
        echo"windows.locaton.href='zuoye.php';";
        echo"</script>";
        exit;
    } else {
        echo "修改失败！";
        exit;
    }
}
?>
